package com.lingyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lingyi.common.utils.StringUtils;
import com.lingyi.system.domain.MaterialLib;
import com.lingyi.system.domain.MessageRecord;
import com.lingyi.system.mapper.MessageRecordMapper;
import com.lingyi.system.service.IMessageRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @PackageName: com.lingyi.system.service.impl
 * @ClassName: MessageRecordServiceImpl
 * @Description:
 * @Author: czl
 * @Date: 2025/4/19 23:32
 */
@Service
@RequiredArgsConstructor
public class MessageRecordServiceImpl extends ServiceImpl<MessageRecordMapper, MessageRecord> implements IMessageRecordService {

    @Override
    public List<MessageRecord> selectByMessageIds(List<Long> messageIds) {
        LambdaQueryWrapper<MessageRecord> queryWrapper = Wrappers.lambdaQuery(MessageRecord.class);
        queryWrapper.in(MessageRecord::getMessageId, messageIds);
        return list(queryWrapper);
    }

    @Override
    public boolean removeByMessageIds(Long[] messageIds) {
        LambdaQueryWrapper<MessageRecord> queryWrapper = Wrappers.lambdaQuery(MessageRecord.class);
        queryWrapper.in(MessageRecord::getMessageId, Arrays.asList(messageIds));
        return remove(queryWrapper);
    }
}
